////////////////////////////////////////////////////////////////////////////////
//
//	Original file Name: TileManager.java
//	Originating Author: JWhitefield
//	
//	Description: Used to create tiles based on the id passed in 
//
////////////////////////////////////////////////////////////////////////////////

package com.jjw.game.world.tile;

import com.jjw.game.graphics.SpriteManager;

/**
 * Used to create tiles based on the id passed in 
 * 
 * @author JWhitefield
 *
 */
public class TileManager {

	//--------------------------------------------------------------------------
	//
	//Properties
	//
	//--------------------------------------------------------------------------
	
	//----------------------------------
	// Public
	//----------------------------------
	
	//----------------------------------
	//  Getters / Setters
	//----------------------------------
	
	//----------------------------------
	// Private
	//----------------------------------
	
	//--------------------------------------------------------------------------
	//
	//  Methods
	//
	//--------------------------------------------------------------------------
	
	//----------------------------------
	// Public
	//----------------------------------
	
	/**
	 * Create the tile for this tile id  
	 * 
	 * @param tileId	the tile id for the type of the that you want created 
	 * 
	 * @return	if found a new tile, if not null
	 */
	public static Tile createTile( String tileId ) {
		
		//Get an instance of the sprite manager
		SpriteManager spriteManager = SpriteManager.getInstance();
		
		//Lower case the reference
		tileId = tileId.toLowerCase();
		
		//Check the blank tile reference
		if( tileId.equals( Tile.BLANK  ) ) {
			return new Tile(tileId, spriteManager.getTileSprite("TileA5", 0, 0) );
		}
		
		//Check the terrain tile reference
		if( tileId.equals( Tile.TERRAIN_GRASS_TILE ) )	{
			return new Tile(tileId, spriteManager.getTileSprite("TileA5", 2, 0) );
		}
		
		
		//Return a null as we found no file  
		return null;
	}
	
	//----------------------------------
	// Private
	//----------------------------------
	
	//----------------------------------
	// Overridden / Implemented
	//----------------------------------
}
